home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIS Performer 2.2 Friends Demo
/
SGI IRIS Performer 2.2 Friends Demo.iso
/
friends
/
technology_playgroup
/
unwinder
/
driver_api
/
uwbasic.h
< prev
Wrap
C/C++ Source or Header
|
1997-11-17
|
3KB
|
106 lines
/**********************************************************************
* TECHNOLOGY PLAYGROUP INC. http://this.is/tpg email: tpg@this.is
**********************************************************************
*
* FILE: uwbasic.h
*
* VERSION: 1.0
* DATE: 17 nov 1997
*
* A simple interface API for the UNWINDER dual joystick adapter v2.1
*
*
* This program is intended as a starting point for communicating
* with the UNWINDER, and not considered a finished product.
*
* see notes with uwbasic.c
*
*
**********************************************************************
* Glenn Silver [Nov97] TPG - current implementation
* Jonathan Franco [Aug97] InfoMediArt - 1st design & implementation
**********************************************************************/
#ifndef __UWBASIC_H__
#define __UWBASIC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
/* UNWINDER joystick data structure */
typedef struct {
unsigned short x; /* X stick axis (left/down) */
unsigned short y; /* Y stick axis (up/down) */
unsigned short z; /* Z stick axis (rotation) */
unsigned short t; /* T stick axis (slider) */
unsigned char buttons; /* all buttons switch status */
unsigned char hat; /* hat position */
unsigned char sw; /* switch on or off (digital mode only) */
} uwJoystick;
/* Button position flag */
#define uwBUTTON_B1 (01<<0)
#define uwBUTTON_B2 (01<<1)
#define uwBUTTON_B3 (01<<2)
#define uwBUTTON_B4 (01<<3)
#define uwBUTTON_B5 (01<<4)
#define uwBUTTON_B6 (01<<5)
#define uwBUTTON_B7 (01<<6)
#define uwBUTTON_B8 (01<<7)
#define uwBUTTON_TRIGGER uwBUTTON_B1
#define uwBUTTON_FRONT uwBUTTON_B2
#define uwBUTTON_SIDE_UP uwBUTTON_B3
#define uwBUTTON_SIDE_DOWN uwBUTTON_B4
#define uwBUTTON_BASE_LEFT_UP uwBUTTON_B5
#define uwBUTTON_BASE_RIGHT_UP uwBUTTON_B6
#define uwBUTTON_BASE_RIGHT_DOWN uwBUTTON_B7
#define uwBUTTON_BASE_LEFT_DOWN uwBUTTON_B8
/* Hat position flag */
#define uwHAT_REST 0
#define uwHAT_UP 1
#define uwHAT_UP_RIGHT 2
#define uwHAT_RIGHT 3
#define uwHAT_DOWN_RIGHT 4
#define uwHAT_DOWN 5
#define uwHAT_DOWN_LEFT 6
#define uwHAT_LEFT 7
#define uwHAT_UP_LEFT 8
/* Low level function */
void uwSendCommands(char *commands);
int uwPollData(char mode, char* data, int byteNb);
void uwFlush(void);
void uwProcessData(char* data, uwJoystick* joy);
/* Initialize and trace command */
int uwOpenPort(char *devicePort, char *initCmd);
void uwClosePort(void);
void uwSetVerbose(int val);
void uwPrint(FILE* fp, uwJoystick* j);
/* Joystick polling */
int uwPoll1(uwJoystick* joystick);
int uwPoll2(uwJoystick* joystick);
int uwPoll12(uwJoystick* joystick1, uwJoystick* joystick2);
/* Note:
- Every functions with a return value, except uwPollData,
return 1 (success) or 0 (fail).
- uwPollData return the number of bytes read or -1 if failed
*/
#ifdef __cplusplus
}
#endif
#endif /* #ifdef __UWBASIC */